home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_vol_sharkarea_door.cog < prev    next >
Text File  |  1999-11-15  |  7KB  |  282 lines

  1. # Jones 3D Cog Script
  2. #
  3. # VOL_sharkareaDoor.cog
  4. #
  5. # Generic Door Script
  6. #
  7. # [CMG]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.     
  14.  
  15.     #..................MESSAGES................
  16.     message        startup        
  17.     message        crossed    
  18.     message        blocked        
  19.     message        activated        
  20.  
  21.     
  22.     #..................ACTORS................
  23.     thing        player                          local
  24.     thing        indy        
  25.     
  26.  
  27.     #..................CAMERAS................
  28.     thing       unlockCam                  
  29.     
  30.  
  31.     #..................CAMERA TARGETS................
  32.     thing        outpathtarget
  33.     thing        indytarget                        local
  34.  
  35.     
  36.     #..................COGS................
  37.     cog            doortalkcog
  38.     
  39.     
  40.     #..................TRIGGERS................
  41.     surface        closeadjoin     
  42.     
  43.     
  44.     #..................PROPS................
  45.     thing        door0        
  46.     thing        door1        
  47.     thing        keybox
  48.     thing        slotkey
  49.     
  50.     
  51.     #..................TEMPLATES.................
  52.     template    ghostTpl=ghost                            local
  53.  
  54.  
  55.     #..................VARIABLES................
  56.     int            open=0                                  local
  57.     int            keyed=0                                 local
  58.     int            checked=0                               local
  59.     int            whichItem                                local
  60.     int            in_left=0                                local
  61.     int            curCam                                    local
  62.     int            keygrumble=0                            local
  63.     int            keyPlace                                local
  64.     int            animId                                    local
  65.     
  66.     flex        in_rotRate                                local
  67.     flex        innerchamber                            local
  68.     
  69.     float        doorspeed=3.0                            local
  70.     float        sleepTime=2.0
  71.     float        lightValueR=0.5
  72.     float        lightValueG=0.5
  73.     float        lightValueB=0.5
  74.         
  75.     
  76.     #..................KEYFRAMES................
  77.     keyframe    inReach=in_activate_medium.key             local
  78.         
  79.     #..................VECTORS................
  80.     vector        vecLightValue                            local
  81.     vector        indyTargPos                                local
  82.     
  83.     #..................SOUND................
  84.     sound       placement=tem_tikikey_place_c.wav       local
  85.     sound        open_cue=mus_gen_awechord1.wav            local
  86.  
  87.  
  88.     sector        doorSector                                local
  89.  
  90.  
  91. end
  92.  
  93. # ========================================================================================
  94.  
  95. code
  96.  
  97. startup:
  98.  
  99.     player = GetLocalPlayerThing();
  100.     in_rotRate = GetThingMaxRotVel(player);
  101.  
  102.     doorSector = GetThingSector(door0);
  103.     SetSectorAdjoins(doorSector, 0);
  104.  
  105.     vecLightValue = VectorSet(lightValueR, lightValueG, lightValueB);
  106.     SetSectorLight(doorSector, vecLightValue, 0.0);        // add some light to door sector
  107.     
  108.     # hide the key that will sit in the lock
  109.     SetThingFlags(slotkey, 0x80000);
  110.     return;
  111.  
  112. # ........................................................................................
  113.  
  114. crossed:
  115.  
  116. if ((GetSenderRef() == closeadjoin)    && (in_left == 0))
  117.  
  118. {
  119.     Rotate(door0, 90, 1, 0.5);
  120.     Rotate(door1, -90, 1, 0.5);
  121.     waitforstop(door0);
  122.     SetSectorAdjoins(doorSector, 0);
  123.     in_left = 1;
  124.     open = 0;
  125. }
  126.     
  127. return;        
  128. #========================================================
  129.  
  130.  
  131. activated:
  132.  
  133. If ((GetSenderRef() == door0) || (GetSenderRef() == door1))
  134.     
  135.     {
  136.            # General "door is locked" grmubling thereafter...
  137.            SetActorFlags(player, 0x200000);
  138.            SendMessageEx(doortalkcog, user5, player, 0, 0, 0);
  139.         PlayMode(player, 60, 1);
  140.            ClearActorFlags(player, 0x200000);
  141.     }
  142.  
  143.         
  144. If ((GetSenderRef() == keybox) && (keyed == 0))
  145.         {    
  146.         # Check if inventory is being used...
  147.         whichItem = GetCurItem(player);
  148.         
  149.         # Prep for scene...
  150.         StartCutScene(1);
  151.         SetActorFlags(player, 0x200000);
  152.         curCam = GetCurrentCamera();
  153.         SetCameraLookInterp(2, 0);
  154.         SetCameraPosInterp(2, 0);
  155.         DeselectWeapon(player); # stow any weapon or lighter
  156.         Sleep(0.25); # wait a beat
  157.         CopyPlayerHolsters(player, indy); # make sure actor has matching props
  158.         SetThingFlags(player, 0x80000);
  159.         ClearThingFlags(indy, 0x80000);
  160.  
  161.         # Line Indy up...
  162.         CopyOrientAndPos(player, indy);
  163.         AISetLookThing(indy, keybox);
  164.         AIWaitForStop(indy);
  165.  
  166.         # Slew follow camera to observe the scene from a known position
  167.         ### SetExtCamLookOffsetToThing(keybox); # new look offset per Matt R...buggy
  168.         SetExtCamOffsetToThing(unlockCam);
  169.         
  170.         # create a target right above and in front of indy actor
  171.         indyTargPos = VectorAdd(VectorTransformToOrient(indy, '0.0 0.02 0.02'), GetThingPos(indy));
  172.         indytarget = CreateThingAtPos(ghostTpl, GetThingSector(indy), indyTargPos, '0 0 0');
  173.         CaptureThing(indytarget);
  174.         
  175.         
  176.         Sleep(0.5);
  177.  
  178.         SetCameraFocus(2, unlockCam);
  179.         SetCameraSecondaryFocus(2, indytarget);
  180.         SetCameraLookInterp(2, 0);
  181.         SetCurrentCamera(2);
  182.     
  183.         if (whichItem == 116)
  184.         {
  185.             ChangeInv(player, 116, -1);
  186.             keyed = 1;
  187.             call innerchamber;
  188.             return;
  189.         }
  190.         else
  191.         {                                
  192.             if (whichItem != 0)
  193.                 {
  194.                 # Take care of wrong keys and items...
  195.                 SendMessageEx(doortalkcog, user0, indy, 116, whichItem, 0);
  196.                 }
  197.         
  198.             else if (keygrumble == 0)
  199.                 {
  200.                 # Note need for key 1st time thru...
  201.                 SendMessageEx(doortalkcog, user4, indy, 1, 3, 0);
  202.                 }
  203.                 
  204.         }
  205.             
  206.             while (global15 == 0)
  207.             {
  208.                 Sleep(0.01); # wait for line to finish
  209.             }
  210.             Sleep(0.3);
  211.             SetCurrentCamera(curCam);
  212.             RestoreExtCam();
  213.             SetThingMaxRotVel(indy, in_rotRate);
  214.             ClearThingFlags(player, 0x80000);
  215.             SetThingFlags(indy, 0x80000);
  216.             ClearActorFlags(player, 0x200000);
  217.             EndCutScene();
  218.  
  219.             return;
  220.         }
  221.     
  222.                       
  223.  
  224. return;
  225.  
  226. # ........................................................................................
  227.  
  228. blocked:
  229.     #print("????");
  230.     return;
  231.  
  232. # ........................................................................................
  233. innerchamber:
  234.  
  235.  
  236. # Play the animations - wait for Indy's
  237. PlayKey(indy, inReach, 4, 0x12, 0);
  238. Sleep(0.5);
  239. keyPlace = PlaySoundLocal(placement, 1.0, 0.0, 0x0, 0);
  240. Sleep(0.25);
  241.  
  242. # show the slotkay and lock it to the keybox
  243. ClearThingFlags(slotkey, 0x80000);
  244. AttachThingToThingEx(slotkey, keybox, 0x000C);
  245.  
  246. # lock box slides into wall
  247. MoveToFrame(keybox, 1, 0.25);
  248. Sleep(0.5);
  249.  
  250. SetThingMaxRotVel(indy, 120);
  251. AISetLookThing(indy, outpathtarget);
  252. Sleep(0.5);
  253. # move camera focus object up to door
  254. animId = MoveThingToPos(indytarget, GetThingPos(outpathtarget), 2.0);
  255.  
  256.  
  257. SetSectorAdjoins(doorSector, 1);
  258. Rotate(door0, -90, 1, doorspeed);
  259. Rotate(door1, 90, 1, doorspeed);
  260. waitforstop(door0);
  261.  
  262. # play music upon door opening completely
  263. PlaySoundLocal(open_cue, 1.0, 0.0, 0x0, 0);
  264. Sleep(0.5);
  265.  
  266. # Return control and camera to player
  267. CopyOrientAndPos(indy, player);
  268. SetCurrentCamera(curCam);
  269. RestoreExtCam();
  270. SetThingMaxRotVel(indy, in_rotRate);
  271. ClearThingFlags(player, 0x80000);
  272. SetThingFlags(indy, 0x80000);
  273. ClearActorFlags(player, 0x200000);
  274. EndCutScene();
  275.  
  276. return;
  277.  
  278.  
  279.     
  280. end
  281.  
  282.